package cn.iocoder.yudao.module.expert.dal.mysql.projectinfo;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.expert.dal.dataobject.projectinfo.ProjectInfoDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.expert.controller.admin.projectinfo.vo.*;

/**
 * 项目信息 Mapper
 *
 * @author 周天贺
 */
@Mapper
public interface ProjectInfoMapper extends BaseMapperX<ProjectInfoDO> {

    default PageResult<ProjectInfoDO> selectPage(ProjectInfoPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ProjectInfoDO>()
                .likeIfPresent(ProjectInfoDO::getProjectName, reqVO.getProjectName())
                .eqIfPresent(ProjectInfoDO::getProjectUnit, reqVO.getProjectUnit())
                .eqIfPresent(ProjectInfoDO::getProjectContacts, reqVO.getProjectContacts())
                .eqIfPresent(ProjectInfoDO::getProjectPhone, reqVO.getProjectPhone())
                .eqIfPresent(ProjectInfoDO::getProjectMajor, reqVO.getProjectMajor())
                .betweenIfPresent(ProjectInfoDO::getProjectTime, reqVO.getProjectTime())
                .eqIfPresent(ProjectInfoDO::getProjectAddress, reqVO.getProjectAddress())
                .eqIfPresent(ProjectInfoDO::getProjectAmount, reqVO.getProjectAmount())
                .betweenIfPresent(ProjectInfoDO::getProjectTendersTime, reqVO.getProjectTendersTime())
                .eqIfPresent(ProjectInfoDO::getRemark, reqVO.getRemark())
                .betweenIfPresent(ProjectInfoDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(ProjectInfoDO::getId));
    }

    void updateExtractBatchNumById(Long id);

}